import 'package:json_annotation/json_annotation.dart';

part 'popular_site_model.g.dart';

@JsonSerializable()
class PopularSiteModel extends Object {
  @JsonKey(name: 'data')
  List<PopularSiteData> data;

  @JsonKey(name: 'errorCode')
  int errorCode;

  @JsonKey(name: 'errorMsg')
  String errorMsg;

  PopularSiteModel(
    this.data,
    this.errorCode,
    this.errorMsg,
  );

  factory PopularSiteModel.fromJson(Map<String, dynamic> srcJson) =>
      _$PopularSiteModelFromJson(srcJson);

  Map<String, dynamic> toJson() => _$PopularSiteModelToJson(this);
}

@JsonSerializable()
class PopularSiteData extends Object {
  @JsonKey(name: 'category')
  String category;

  @JsonKey(name: 'icon')
  String icon;

  @JsonKey(name: 'id')
  int id;

  @JsonKey(name: 'link')
  String link;

  @JsonKey(name: 'name')
  String name;

  @JsonKey(name: 'order')
  int order;

  @JsonKey(name: 'visible')
  int visible;

  PopularSiteData(
    this.category,
    this.icon,
    this.id,
    this.link,
    this.name,
    this.order,
    this.visible,
  );

  factory PopularSiteData.fromJson(Map<String, dynamic> srcJson) =>
      _$PopularSiteDataFromJson(srcJson);

  Map<String, dynamic> toJson() => _$PopularSiteDataToJson(this);
}
